import 'package:oramemo/generated/json/base/json_convert_content.dart';
import 'package:oramemo/entity/getinfo_entity.dart';

GetinfoEntity $GetinfoEntityFromJson(Map<String, dynamic> json) {
  final GetinfoEntity getinfoEntity = GetinfoEntity();
  final String? msg = jsonConvert.convert<String>(json['msg']);
  if (msg != null) {
    getinfoEntity.msg = msg;
  }
  final int? code = jsonConvert.convert<int>(json['code']);
  if (code != null) {
    getinfoEntity.code = code;
  }
  final List<String>? permissions = (json['permissions'] as List<dynamic>?)
      ?.map(
          (e) => jsonConvert.convert<String>(e) as String)
      .toList();
  if (permissions != null) {
    getinfoEntity.permissions = permissions;
  }
  final List<String>? roles = (json['roles'] as List<dynamic>?)?.map(
          (e) => jsonConvert.convert<String>(e) as String).toList();
  if (roles != null) {
    getinfoEntity.roles = roles;
  }
  final GetinfoUser? user = jsonConvert.convert<GetinfoUser>(json['user']);
  if (user != null) {
    getinfoEntity.user = user;
  }
  return getinfoEntity;
}

Map<String, dynamic> $GetinfoEntityToJson(GetinfoEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['msg'] = entity.msg;
  data['code'] = entity.code;
  data['permissions'] = entity.permissions;
  data['roles'] = entity.roles;
  data['user'] = entity.user?.toJson();
  return data;
}

extension GetinfoEntityExtension on GetinfoEntity {
  GetinfoEntity copyWith({
    String? msg,
    int? code,
    List<String>? permissions,
    List<String>? roles,
    GetinfoUser? user,
  }) {
    return GetinfoEntity()
      ..msg = msg ?? this.msg
      ..code = code ?? this.code
      ..permissions = permissions ?? this.permissions
      ..roles = roles ?? this.roles
      ..user = user ?? this.user;
  }
}

GetinfoUser $GetinfoUserFromJson(Map<String, dynamic> json) {
  final GetinfoUser getinfoUser = GetinfoUser();
  final String? createBy = jsonConvert.convert<String>(json['createBy']);
  if (createBy != null) {
    getinfoUser.createBy = createBy;
  }
  final String? createTime = jsonConvert.convert<String>(json['createTime']);
  if (createTime != null) {
    getinfoUser.createTime = createTime;
  }
  final GetinfoUserParams? params = jsonConvert.convert<GetinfoUserParams>(
      json['params']);
  if (params != null) {
    getinfoUser.params = params;
  }
  final String? userType = jsonConvert.convert<String>(json['userType']);
  if (userType != null) {
    getinfoUser.userType = userType;
  }
  final int? userId = jsonConvert.convert<int>(json['userId']);
  if (userId != null) {
    getinfoUser.userId = userId;
  }
  final String? userName = jsonConvert.convert<String>(json['userName']);
  if (userName != null) {
    getinfoUser.userName = userName;
  }
  final String? nickName = jsonConvert.convert<String>(json['nickName']);
  if (nickName != null) {
    getinfoUser.nickName = nickName;
  }
  final String? email = jsonConvert.convert<String>(json['email']);
  if (email != null) {
    getinfoUser.email = email;
  }
  final String? phonenumber = jsonConvert.convert<String>(json['phonenumber']);
  if (phonenumber != null) {
    getinfoUser.phonenumber = phonenumber;
  }
  final String? sex = jsonConvert.convert<String>(json['sex']);
  if (sex != null) {
    getinfoUser.sex = sex;
  }
  final String? avatar = jsonConvert.convert<String>(json['avatar']);
  if (avatar != null) {
    getinfoUser.avatar = avatar;
  }
  final String? password = jsonConvert.convert<String>(json['password']);
  if (password != null) {
    getinfoUser.password = password;
  }
  final String? status = jsonConvert.convert<String>(json['status']);
  if (status != null) {
    getinfoUser.status = status;
  }
  final String? delFlag = jsonConvert.convert<String>(json['delFlag']);
  if (delFlag != null) {
    getinfoUser.delFlag = delFlag;
  }
  final String? loginIp = jsonConvert.convert<String>(json['loginIp']);
  if (loginIp != null) {
    getinfoUser.loginIp = loginIp;
  }
  final List<GetinfoUserRoles>? roles = (json['roles'] as List<dynamic>?)
      ?.map(
          (e) => jsonConvert.convert<GetinfoUserRoles>(e) as GetinfoUserRoles)
      .toList();
  if (roles != null) {
    getinfoUser.roles = roles;
  }
  final bool? admin = jsonConvert.convert<bool>(json['admin']);
  if (admin != null) {
    getinfoUser.admin = admin;
  }
  return getinfoUser;
}

Map<String, dynamic> $GetinfoUserToJson(GetinfoUser entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['createBy'] = entity.createBy;
  data['createTime'] = entity.createTime;
  data['params'] = entity.params?.toJson();
  data['userType'] = entity.userType;
  data['userId'] = entity.userId;
  data['userName'] = entity.userName;
  data['nickName'] = entity.nickName;
  data['email'] = entity.email;
  data['phonenumber'] = entity.phonenumber;
  data['sex'] = entity.sex;
  data['avatar'] = entity.avatar;
  data['password'] = entity.password;
  data['status'] = entity.status;
  data['delFlag'] = entity.delFlag;
  data['loginIp'] = entity.loginIp;
  data['roles'] = entity.roles?.map((v) => v.toJson()).toList();
  data['admin'] = entity.admin;
  return data;
}

extension GetinfoUserExtension on GetinfoUser {
  GetinfoUser copyWith({
    String? createBy,
    String? createTime,
    GetinfoUserParams? params,
    String? userType,
    int? userId,
    String? userName,
    String? nickName,
    String? email,
    String? phonenumber,
    String? sex,
    String? avatar,
    String? password,
    String? status,
    String? delFlag,
    String? loginIp,
    List<GetinfoUserRoles>? roles,
    bool? admin,
  }) {
    return GetinfoUser()
      ..createBy = createBy ?? this.createBy
      ..createTime = createTime ?? this.createTime
      ..params = params ?? this.params
      ..userType = userType ?? this.userType
      ..userId = userId ?? this.userId
      ..userName = userName ?? this.userName
      ..nickName = nickName ?? this.nickName
      ..email = email ?? this.email
      ..phonenumber = phonenumber ?? this.phonenumber
      ..sex = sex ?? this.sex
      ..avatar = avatar ?? this.avatar
      ..password = password ?? this.password
      ..status = status ?? this.status
      ..delFlag = delFlag ?? this.delFlag
      ..loginIp = loginIp ?? this.loginIp
      ..roles = roles ?? this.roles
      ..admin = admin ?? this.admin;
  }
}

GetinfoUserParams $GetinfoUserParamsFromJson(Map<String, dynamic> json) {
  final GetinfoUserParams getinfoUserParams = GetinfoUserParams();
  return getinfoUserParams;
}

Map<String, dynamic> $GetinfoUserParamsToJson(GetinfoUserParams entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  return data;
}

extension GetinfoUserParamsExtension on GetinfoUserParams {
}

GetinfoUserRoles $GetinfoUserRolesFromJson(Map<String, dynamic> json) {
  final GetinfoUserRoles getinfoUserRoles = GetinfoUserRoles();
  final GetinfoUserRolesParams? params = jsonConvert.convert<
      GetinfoUserRolesParams>(json['params']);
  if (params != null) {
    getinfoUserRoles.params = params;
  }
  final int? roleId = jsonConvert.convert<int>(json['roleId']);
  if (roleId != null) {
    getinfoUserRoles.roleId = roleId;
  }
  final String? roleName = jsonConvert.convert<String>(json['roleName']);
  if (roleName != null) {
    getinfoUserRoles.roleName = roleName;
  }
  final String? roleKey = jsonConvert.convert<String>(json['roleKey']);
  if (roleKey != null) {
    getinfoUserRoles.roleKey = roleKey;
  }
  final String? roleSort = jsonConvert.convert<String>(json['roleSort']);
  if (roleSort != null) {
    getinfoUserRoles.roleSort = roleSort;
  }
  final String? dataScope = jsonConvert.convert<String>(json['dataScope']);
  if (dataScope != null) {
    getinfoUserRoles.dataScope = dataScope;
  }
  final bool? menuCheckStrictly = jsonConvert.convert<bool>(
      json['menuCheckStrictly']);
  if (menuCheckStrictly != null) {
    getinfoUserRoles.menuCheckStrictly = menuCheckStrictly;
  }
  final bool? deptCheckStrictly = jsonConvert.convert<bool>(
      json['deptCheckStrictly']);
  if (deptCheckStrictly != null) {
    getinfoUserRoles.deptCheckStrictly = deptCheckStrictly;
  }
  final String? status = jsonConvert.convert<String>(json['status']);
  if (status != null) {
    getinfoUserRoles.status = status;
  }
  final bool? flag = jsonConvert.convert<bool>(json['flag']);
  if (flag != null) {
    getinfoUserRoles.flag = flag;
  }
  final bool? admin = jsonConvert.convert<bool>(json['admin']);
  if (admin != null) {
    getinfoUserRoles.admin = admin;
  }
  return getinfoUserRoles;
}

Map<String, dynamic> $GetinfoUserRolesToJson(GetinfoUserRoles entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['params'] = entity.params?.toJson();
  data['roleId'] = entity.roleId;
  data['roleName'] = entity.roleName;
  data['roleKey'] = entity.roleKey;
  data['roleSort'] = entity.roleSort;
  data['dataScope'] = entity.dataScope;
  data['menuCheckStrictly'] = entity.menuCheckStrictly;
  data['deptCheckStrictly'] = entity.deptCheckStrictly;
  data['status'] = entity.status;
  data['flag'] = entity.flag;
  data['admin'] = entity.admin;
  return data;
}

extension GetinfoUserRolesExtension on GetinfoUserRoles {
  GetinfoUserRoles copyWith({
    GetinfoUserRolesParams? params,
    int? roleId,
    String? roleName,
    String? roleKey,
    String? roleSort,
    String? dataScope,
    bool? menuCheckStrictly,
    bool? deptCheckStrictly,
    String? status,
    bool? flag,
    bool? admin,
  }) {
    return GetinfoUserRoles()
      ..params = params ?? this.params
      ..roleId = roleId ?? this.roleId
      ..roleName = roleName ?? this.roleName
      ..roleKey = roleKey ?? this.roleKey
      ..roleSort = roleSort ?? this.roleSort
      ..dataScope = dataScope ?? this.dataScope
      ..menuCheckStrictly = menuCheckStrictly ?? this.menuCheckStrictly
      ..deptCheckStrictly = deptCheckStrictly ?? this.deptCheckStrictly
      ..status = status ?? this.status
      ..flag = flag ?? this.flag
      ..admin = admin ?? this.admin;
  }
}

GetinfoUserRolesParams $GetinfoUserRolesParamsFromJson(
    Map<String, dynamic> json) {
  final GetinfoUserRolesParams getinfoUserRolesParams = GetinfoUserRolesParams();
  return getinfoUserRolesParams;
}

Map<String, dynamic> $GetinfoUserRolesParamsToJson(
    GetinfoUserRolesParams entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  return data;
}

extension GetinfoUserRolesParamsExtension on GetinfoUserRolesParams {
}